package com.huarui.employee.dao.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.ewaf.framework.dao.impl.BaseDaoImpl;
import com.huarui.employee.dao.IHireHistoryDao;
import com.huarui.employee.model.HireHistory;

public class HireHistoryDaoImpl extends BaseDaoImpl implements IHireHistoryDao {

	@SuppressWarnings("unchecked")
	@Override
	public HireHistory getHireHistoryByGmt(Integer userId, Date gmtCreate) {

		Map map = new HashMap();
		map.put("userId", userId);
		map.put("gmtcreate", gmtCreate);

		return (HireHistory) getSqlMapClientTemplate().queryForObject(
				namespace + ".getByGmt", map);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HireHistory> getByCompanyId(Integer companyId) {

		return getSqlMapClientTemplate().queryForList(
				namespace + ".getByCompanyId", companyId);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HireHistory> getAllEmployeeHireHistory() {

		return getSqlMapClientTemplate().queryForList(
				namespace + ".getAllEmployeeHireHistory");

	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HireHistory> getByUserId(Map map) {

		return getSqlMapClientTemplate().queryForList(
				namespace + ".getByUserId", map);
	}

	@Override
	public int countByConditions(Integer userId) {

		return (Integer) getSqlMapClientTemplate().queryForObject(
				namespace + ".countByConditions", userId);
	}

}
